/*
 * Order Router
 * @Author: chiangbt@geoportal.cn 
 * @Date: 2019-05-07 13:47:55 
 * @Last Modified by: chiangbt@geoportal.cn
 * @Last Modified time: 2019-05-09 11:24:33
 */
const express = require("express");
const router = express.Router();
const jwt = require('express-jwt');
const orderController = require('../controllers/orderController');

/**
 * 获取前15个订单
 * 使用express-jwt作token验证, 另一种验证方法，其余使用自定义checkAuth
 */
router.get("/orders", jwt({
    secret: process.env.SecretOrPublicKey
}), orderController.order_get_all);

/**
 * 新增一个order
 */
router.post("/orders", jwt({
    secret: process.env.SecretOrPublicKey
}), orderController.create_order);

/**
 * 获取指定的order
 */
router.get("/orders/:id", jwt({
    secret: process.env.SecretOrPublicKey
}), orderController.order_get_by_id);

/**
 * 删除指定的order
 */
router.delete("/orders/:id", jwt({
    secret: process.env.SecretOrPublicKey
}), orderController.order_delete);

module.exports = router;